package itman.elm.controller;

import itman.elm.po.Food;
import itman.elm.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("FoodController")
public class FoodController {

    @Autowired
    private FoodService foodService;

    /**
     *据商家编号查询所属食品信息
     * @param businessId
     * @return
     */
    @RequestMapping("listFoodByBusinessId")
    public List<Food> listFoodByBusinessId(Integer businessId){
        return foodService.listFoodByBusinessId(businessId);
    }

    /**
     *更具食品编号查询所属信息
     * @param foodId
     * @return
     */
    @RequestMapping("getFoodById")
    public Food getFoodById(Integer foodId) {
        return foodService.getFoodById(foodId);
    }
}
